/* eslint-disable jsdoc/no-restricted-syntax */
/**
 * #__NO_SIDE_EFFECTS__
 * @name defineComponent
 * @use __App__.component(name, defineComponent());
 * @template {ng.IComponentOptions} T
 * @param {T} comp
 * @returns {T}
 */
export function defineComponent(comp) {
  return comp;
}

/**
 * #__NO_SIDE_EFFECTS__
 * @name defineComponentNamed
 * @use __App__.component(...defineComponentNamed());
 * @use __App__.component.apply(__App__, defineComponentNamed());
 * @template {ng.IComponentOptions} T
 * @param {string} name
 * @param {T} comp
 * @returns {[string, T]}
 */
export function defineComponentNamed(name, comp) {
  return [camelCase(name), comp];
}
/* --------------------------------------------------------- */
/**
 * #__NO_SIDE_EFFECTS__
 * @name defineDirective
 * @use __App__.directive(name, defineDirective())
 * @template {ng.IScope} TScope
 * @template {JQLite} TElement
 * @template {ng.IAttributes} TAttrs
 * @template {ng.IController} TController
 * @param {(...args: any[]) => ng.IDirective<TScope, TElement, TAttrs, TController>} directiveFn
 * @param {string[]=} $inject
 * @returns {ng.Injectable<ng.IDirectiveFactory<TScope, TElement, TAttrs, TController>>}
 */
export function defineDirective(directiveFn, $inject = []) {
  directiveFn.$inject = $inject;
  return directiveFn;
}

/**
 * #__NO_SIDE_EFFECTS__
 * @name defineDirectiveNamed
 * @use __App__.directive(...defineDirectiveNamed())
 * @use __App__.directive.apply(__App__, defineDirectiveNamed())
 * @template {ng.IScope} TScope
 * @template {JQLite} TElement
 * @template {ng.IAttributes} TAttrs
 * @template {ng.IController} TController
 * @param {string} kebabName
 * @param {(...args: any[]) => ng.IDirective<TScope, TElement, TAttrs, TController>} directiveFn
 * @param {string[]=} $inject
 * @returns {[string, ng.Injectable<ng.IDirectiveFactory<TScope, TElement, TAttrs, TController>>]}
 */
export function defineDirectiveNamed(kebabName, directiveFn, $inject = []) {
  directiveFn.$inject = $inject;
  return [camelCase(kebabName), directiveFn];
}

/**
 * #__NO_SIDE_EFFECTS__
 * @name defineDirectiveLink
 * @use __App__.directive(name, defineDirectiveLink())
 * @template {ng.IScope} TScope
 * @template {JQLite} TElement
 * @template {ng.IAttributes} TAttrs
 * @template {ng.IController} TController
 * @param {(...args: any[]) => ng.IDirectiveLinkFn<TScope, TElement, TAttrs, TController>} linkFn
 * @param {string[]=} inject
 * @returns {ng.Injectable<(...args: any[]) => ng.IDirectiveLinkFn<TScope, TElement, TAttrs, TController>>}
 */
export function defineDirectiveLink(linkFn, inject = []) {
  if (inject.length) {
    return [...inject, linkFn];
  }
  return linkFn;
}

/**
 * #__NO_SIDE_EFFECTS__
 * @name defineDirectiveLinkNamed
 * @use __App__.directive(...defineDirectiveLinkNamed())
 * @use __App__.directive.apply(__App__, defineDirectiveLinkNamed())
 * @template {ng.IScope} TScope
 * @template {JQLite} TElement
 * @template {ng.IAttributes} TAttrs
 * @template {ng.IController} TController
 * @param {string} kebabName
 * @param {(...args: any[]) => ng.IDirectiveLinkFn<TScope, TElement, TAttrs, TController>} linkFn
 * @param {string[]=} $inject
 * @returns {[string,ng.Injectable<(...args: any[]) => ng.IDirectiveLinkFn<TScope, TElement, TAttrs, TController>>]}
 */
export function defineDirectiveLinkNamed(kebabName, linkFn, $inject = []) {
  linkFn.$inject = $inject;
  return [camelCase(kebabName), linkFn];
}
